<template>
	<view class="mx-course-item" @tap="toDetail">
		<view class="course-img" :style="{backgroundImage: `url(${icon})`}"></view>
		<view class="course-info">
			<view class="course-name">
				{{name}}
			</view>
			<view class="lesson-hour">
				共{{classLessons}}节
			</view>
			<view class="course-amount">
				￥{{amount}}
			</view>
		</view>
	</view>
</template>

<script>
	import { imgUrl } from '@/utils/config.js'
	export default {
		name:"MxRecomCourseItem",
		props: {
			id: {
				type: Number
			},
			
			img: {
				type: String
			},
			
			name: {
				type: String
			},
			
			classLessons: {
				type: Number
			},
			
			amount: {
				type: String
			}
		},
		data() {
			return {
				
			};
		},
		computed: {
			icon() {
				return imgUrl + this.img
			}
		},
		methods: {
			toDetail() {
				uni.navigateTo({
					url: `/pages/course/course-detail?courseId=${this.id}`
				})
			}
		}
	}
</script>

<style scoped lang="scss">
@import '@/common/scss/mixins.scss';
@import '@/common/scss/var.scss';
.mx-course-item{
	font-family: $font-family;
	box-sizing: border-box;
	width: 100%;
	display: flex;
	align-items: center;
	
	.course-img{
		width: 290rpx;
		height: 208rpx;
		border-radius: 6px;
		@include bg-img-cover;
	}
	
	.course-info{
		margin-left: 14rpx;
		align-self: flex-start;
		.course-name{
			margin-top: 14rpx;
			margin-bottom: 22rpx;
			font-size: 16px;
			line-height: 16px;
			font-weight: bold;
		}
		.lesson-hour{
			font-size: 14px;
			color: $color-info;
		}
		.course-amount{
			margin-top: 26rpx;
			font-size: 14px;
			font-weight: bold;
			color: $color-amount;
		}
	}
}
</style>
